//
//  SwitchCell.m
//  Estate
//
//  Created by wangdongdong on 2017/10/10.
//  Copyright © 2017年 ttsx. All rights reserved.
//

#import "SwitchCell.h"

@implementation SwitchCell

- (void)awakeFromNib {
    [super awakeFromNib];

    self.nameLabel.textColor = UIColorFromRGB(0x33333);
    // 装填
    [self.rightSwitch addTarget:self action:@selector(supervisionEvaluation:) forControlEvents:UIControlEventValueChanged];
}

// 回调状态
- (void)supervisionEvaluation:(UISwitch *)switchButton {
    BOOL isButtonOn = [switchButton isOn];
    
    if (self.allBlock) {
        if (isButtonOn) {
            self.allBlock(@"1");
            
        } else {
            self.allBlock(@"0");
        }
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
